package com.zhora.ai.v1.business.impl;

import com.zhora.ai.v1.business.IAiLibraryDocSegmentBusinessService;
import com.zhora.ai.v1.dto.AiLibraryDocSegmentDetailDTO;
import com.zhora.ai.v1.dto.AiLibraryDocSegmentListDTO;
import com.zhora.ai.v1.vo.AiLibraryDocSegmentListVO;
import com.zhora.common.utils.ConvertUtils;
import com.zhora.dto.ai.search.AiLibraryDocSegmentSearchDTO;
import com.zhora.service.ai.IAiLibraryDocSegmentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * doc片段处理
 *
 * @author zhehen.lu
 * @date 2025/9/28 16:07
 */
@Service
@Slf4j
public class AiLibraryDocSegmentBusinessServiceImpl implements IAiLibraryDocSegmentBusinessService {

    @Autowired
    IAiLibraryDocSegmentService aiLibraryDocSegmentService;

    @Override
    public AiLibraryDocSegmentDetailDTO getDetailById(Long id) {
        return ConvertUtils.sourceToTarget(aiLibraryDocSegmentService.getDetailById(id), AiLibraryDocSegmentDetailDTO.class);
    }

    @Override
    public List<AiLibraryDocSegmentListDTO> list(AiLibraryDocSegmentListVO listVO) {
        AiLibraryDocSegmentSearchDTO searchDTO = ConvertUtils.sourceToTarget(listVO, AiLibraryDocSegmentSearchDTO.class);
        searchDTO.setDelFlag(Boolean.FALSE);
        return ConvertUtils.sourceToTarget(aiLibraryDocSegmentService.list(searchDTO), AiLibraryDocSegmentListDTO.class);
    }
}
